<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用指定的ID弹出一个元素的innerHTML </title>
</head>

<body>
    <h1 id="myHeader" onclick="getValue()">点击我!</h1>
    <script>
        function getValue() {
            var x = document.getElementById("myHeader");
            alert(x.innerHTML);
        }
    </script>
</body>

</html>